<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <div id="app"></div>
  
  <script type="module">
    import { reactive, effect } from './reactivity/index.js'

    // const obj = {
    //   foo: 1,
    //   get bar () {
    //     return this.foo
    //   }
    // }

    // const p = reactive(obj)

    // effect(() => {
    //   console.log(p.bar)
    //   for (const key in p) {
    //     console.log(key)
    //   }
    // })
    // p.foo++
    // p.foo++
    // p.foo++


    // delete p.bar

    const obj = {
      a: {b: 1}
    }
    const proto = {bar: 1}
    const child = reactive(obj)
    const parent = reactive(proto)
    Object.setPrototypeOf(child, parent)

    effect(() => {
      // console.log(child.bar)
      console.log(child.a.b)
    })
    // child.bar++
    // child.bar++
    child.a.b++
    child.a.b++


  </script>
</body>
</html>
